{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6fc8d097-ddb5-4354-bc6c-914618a577db",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入您的姓名： 郑\n",
      "请输入您的出生年份： 2004\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "您好！郑。您20岁。\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "sName = input(\"请输入您的姓名：\")\n",
    "birthyear = int(input(\"请输入您的出生年份：\"))  #把输入值通过int转换为整型\n",
    "age = datetime.date.today().year - birthyear\n",
    "print(\"您好！{0}。您{1}岁。\".format(sName, age))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f167af8d-8bd4-4692-8ebc-7375012f44ca",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
